Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] remove the code that XA0121 deprecates #3857

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Oct 29, 2019

Context: #3654
Context: https://docs.microsoft.com/en-us/xamarin/android/release-notes/10/10.1#xa0121-deprecation-warning-for-old-xamarinandroidsupport-library-versions

In VS 16.4 / Xamarin.Android 10.1, we deprecated
<GetAdditionalResourcesFromAssemblies/>.

This PR removes the behavior completely for 16.5, since it uses SHA1.
We aim to remove all SHA1 and MD5 usage for 16.5.

NuGet packages I've seen that no longer work:

  • Android Support Libraries, 25.x and older
  • Google Play Services older than 44.x

I have still been able to use an old Xamarin.Forms (2.3.4) in
combination with newer support libraries.

XA0121 is now an error

We give a build error now in <FilterAssemblies/> if we encounter the
unsupported attributes. This target runs very early in the build, so
we have to do it at this point.

JcwGen-Tests

These tests were using these attributes such as:

[assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
    SourceUrl="file:///JavaLib.zip")]
[assembly: Java.Interop.JavaLibraryReference ("classes.jar",
    SourceUrl="file:///JavaLib.zip")]
[assembly: Android.NativeLibraryReference ("arm64-v8a/libsimple.so",
    SourceUrl="file:///NativeLib.zip", Version="native-lib-1")]

Instead, I switched to use @(LibraryProjectZip) for the .aar file
and @(EmbeddedNativeLibrary) for the .so files.

Designer Tests

The designer tests build the MyDriving app:

https://github.com/Azure-Samples/MyDriving

Which uses old NuGet packages that now fail, and is now in read-only
mode on Github. I suspect we may just need to remove that test?

error XA0121: Assembly 'Xamarin.Android.Support.CustomTabs' is using
    '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported.
    Use a newer version of this NuGet package or notify the library author.

@jonathanpeppers jonathanpeppers force-pushed the additional-is-dead branch 5 times, most recently from ee19f6b to 7c4284d Compare November 1, 2019 19:47
@jonathanpeppers jonathanpeppers marked this pull request as ready for review November 2, 2019 02:35
@jonathanpeppers
Copy link
Member Author

@garuma with the changes here, the MyDriving app won't build anymore unless the NuGet packages are updated. Is that worth it, or do you think it could be dropped from the Designer's tests?

Their repo is readonly now: https://github.com/Azure-Samples/MyDriving

@jonathanpeppers
Copy link
Member Author

I started a build on a public branch: https://build.azdo.io/3211313

To see how our regression tests fare, I suspect I will need to update lots of projects 😨

@garuma
Copy link
Contributor

garuma commented Nov 4, 2019

@jonathanpeppers hmmm, ideally I would want to keep the project (doing the updates that are needed) as it usually tends to uncover a lot of good regression with those style of older projects, should we try to fork the repo and work and making it compliant with this change?

@jonathanpeppers
Copy link
Member Author

@garuma do you have a fork already with some changes?

You have this change somewhere for aapt2: Azure-Samples/MyDriving#607

There might be other changes, too, I vaguely remember some.

Context: dotnet#3654
Context: https://docs.microsoft.com/en-us/xamarin/android/release-notes/10/10.1#xa0121-deprecation-warning-for-old-xamarinandroidsupport-library-versions

In VS 16.4 / Xamarin.Android 10.1, we deprecated
`<GetAdditionalResourcesFromAssemblies/>`.

This PR removes the behavior completely for 16.5, since it uses SHA1.
We aim to remove all SHA1 and MD5 usage for 16.5.

NuGet packages I've seen that no longer work:

* Android Support Libraries, 25.x and older
* Google Play Services older than 44.x

I have still been able to use an old Xamarin.Forms (2.3.4) in
combination with newer support libraries.

~~ XA0121 is now an error ~~

We give a build error now in `<FilterAssemblies/>` if we encounter the
unsupported attributes. This target runs very early in the build, so
we have to do it at this point.

~~ JcwGen-Tests ~~

These tests were using these attributes such as:

    [assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
        SourceUrl="file:///JavaLib.zip")]
    [assembly: Java.Interop.JavaLibraryReference ("classes.jar",
        SourceUrl="file:///JavaLib.zip")]
    [assembly: Android.NativeLibraryReference ("arm64-v8a/libsimple.so",
        SourceUrl="file:///NativeLib.zip", Version="native-lib-1")]

Instead, I switched to use `@(LibraryProjectZip)` for the `.aar` file
and `@(EmbeddedNativeLibrary)` for the `.so` files.

~~ Designer Tests ~~

The designer tests build the MyDriving app:

https://github.com/Azure-Samples/MyDriving

Which uses old NuGet packages that now fail, and is now in read-only
mode on Github. I suspect we may just need to remove that test?

    error XA0121: Assembly 'Xamarin.Android.Support.CustomTabs' is using
        '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported.
        Use a newer version of this NuGet package or notify the library author.
@@ -1534,25 +1534,6 @@ public void BuildApplicationCheckThatAddStaticResourcesTargetDoesNotRerun ()
}
}

[Test]
[Ignore ("Re enable when MergeResources work is complete")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future work. Let's remove all of the tests labeled with this. As well as the code for the managed resource merger. I think we are just going to use the google tooling (aapt2) going forward.

// Clean the Resource Cache.
if (!TestEnvironment.IsRunningOnCI)
return;
if (Directory.Exists (CachePath)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brings up an interesting thought. Should we be deleting this Cache for the user? or issue a warning that they can now remove this directory? It might be taking up valuable space.

Its probably something for the release notes I think.

Copy link
Member Author

@jonathanpeppers jonathanpeppers Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should probably document on the next release notes for 10.2 that will expand upon: https://docs.microsoft.com/en-us/xamarin/android/release-notes/10/10.1#xa0121-deprecation-warning-for-old-xamarinandroidsupport-library-versions

I don't know about automatically deleting/warning about it, though. You can install VS side-by-side on Windows, and they could have 2017, etc.

@dellis1972 dellis1972 merged commit 1a61fa8 into dotnet:master Nov 11, 2019
@jonathanpeppers jonathanpeppers deleted the additional-is-dead branch November 11, 2019 19:00
jonpryor pushed a commit that referenced this pull request Nov 20, 2019
…3857)

Context: #3654
Context: https://docs.microsoft.com/en-us/xamarin/android/release-notes/10/10.1#xa0121-deprecation-warning-for-old-xamarinandroidsupport-library-versions

In VS 16.4 / Xamarin.Android 10.1, we deprecated
`<GetAdditionalResourcesFromAssemblies/>`.

This PR removes the behavior completely for 16.5, since it uses SHA1.
We aim to remove all SHA1 and MD5 usage for 16.5.

NuGet packages I've seen that no longer work:

* Android Support Libraries, 25.x and older
* Google Play Services older than 44.x

I have still been able to use an old Xamarin.Forms (2.3.4) in
combination with newer support libraries.

~~ XA0121 is now an error ~~

We give a build error now in `<FilterAssemblies/>` if we encounter the
unsupported attributes. This target runs very early in the build, so
we have to do it at this point.

~~ JcwGen-Tests ~~

These tests were using these attributes such as:

    [assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
        SourceUrl="file:///JavaLib.zip")]
    [assembly: Java.Interop.JavaLibraryReference ("classes.jar",
        SourceUrl="file:///JavaLib.zip")]
    [assembly: Android.NativeLibraryReference ("arm64-v8a/libsimple.so",
        SourceUrl="file:///NativeLib.zip", Version="native-lib-1")]

Instead, I switched to use `@(LibraryProjectZip)` for the `.aar` file
and `@(EmbeddedNativeLibrary)` for the `.so` files.

~~ Designer Tests ~~

The designer tests build the MyDriving app:

https://github.com/Azure-Samples/MyDriving

Which uses old NuGet packages that now fail, and is now in read-only
mode on Github. I suspect we may just need to remove that test?

    error XA0121: Assembly 'Xamarin.Android.Support.CustomTabs' is using
        '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported.
        Use a newer version of this NuGet package or notify the library author.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants